package com.mustafaiev.tair.cts.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.apache.tapestry5.beaneditor.NonVisual;

import com.mustafaiev.tair.cts.enums.PurchaseType;

/**
 * @author tair
 * 
 */
@Entity
@Table(name = "purchases")
public class Purchase implements ICostTrackingSystemModel {

    private static final long serialVersionUID = 6567120149089899262L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @NonVisual
    private Long id;

    @ManyToOne
    @JoinColumn(name = "basket_id")
    private Basket basket;

    private String title;

    private double count;

    private double cost;

    private PurchaseType type;

    @ManyToOne
    @JoinColumn(name = "owner_id", nullable = true)
    private Payer owner;

    public Long getId() {
        return id;
    }

    public void setId(final Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(final String title) {
        this.title = title;
    }

    public double getCount() {
        return count;
    }

    public void setCount(final double count) {
        this.count = count;
    }

    public double getCost() {
        return cost;
    }

    public void setCost(final double cost) {
        this.cost = cost;
    }

    public Basket getBasket() {
        return basket;
    }

    public void setBasket(final Basket basket) {
        this.basket = basket;
    }

    public PurchaseType getType() {
        return type;
    }

    public void setType(final PurchaseType type) {
        this.type = type;
    }

    public Payer getOwner() {
        return owner;
    }

    public void setOwner(final Payer owner) {
        this.owner = owner;
    }

}
